#ifndef DOUBLESLIDER_H
#define DOUBLESLIDER_H

#include <QWidget>
#include <QPainter>
#include <QMouseEvent>

#include <QColor>
#include <QRectF>


class DoubleSlider : public QWidget
{
    Q_OBJECT

public:
    DoubleSlider(QWidget *parent);
    ~DoubleSlider();
    void draw(QPainter *painter);

    QRectF m_slider[2];
    QRectF slider1;
    void reset();
	void reset(float min, float max);
    void updateSectionBox();
	signals:
	void slider0Change(int x);
	void slider1Change(int x);
		
protected:
    void paintEvent(QPaintEvent *event);
    void mousePressEvent(QMouseEvent *event);
    void mouseMoveEvent(QMouseEvent *event);
    void mouseReleaseEvent(QMouseEvent *event);
    void resizeEvent(QResizeEvent *);

private:
	int m_max = 10000;
	float m_value[2] = { 0.0f ,1.0f};

    QPointF prePoint;
    bool sliderSelected[2];
    bool selected;
    bool slider2Selected;
    bool isPointInRect(QPointF point, QRectF rect);
    bool isPointBetweenTwoRects(QPointF point, QRectF rect1, QRectF rect2);

    bool connectedSectionBox;

};

#endif // DOUBLESLIDER_H